package com.tanhua.sso.server.controller;

import com.tanhua.sso.server.service.PeachblossomService;
import com.tanhua.sso.vo.VoiceVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@RestController
@RequestMapping("/peachblossom")
public class PeachblossomController {

    @Autowired
    private PeachblossomService peachblossomService;

    //挑花传音
    @PostMapping
    public ResponseEntity sendPeachblossom(MultipartFile soundFile) {
        peachblossomService.sendPeachblossom(soundFile);
        return ResponseEntity.ok(null);
    }

    //接收语音
    @GetMapping
    public ResponseEntity acceptPeachblossom(){
        VoiceVo voiceVo=peachblossomService.acceptPeachblossom();
        return ResponseEntity.ok(voiceVo);
    }
}
